package org.example.genericreflect;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

class RepositoryAspect implements InvocationHandler {
    @Override
    public Object invoke(Object proxy, Method method, Object[] args1) throws Throwable {
        Class<?> declaringClass = method.getDeclaringClass();
        ReflectUtil.logMethods(proxy.getClass());
        if (declaringClass == Repository.class || declaringClass == UserRepositoryCustom.class) {
            return null;
        } else {
            return method.invoke(proxy, args1);
        }
    }
}
